package com.example.chatroom.service;

import com.example.chatroom.entity.FriendEntity;
import com.example.chatroom.entity.MessageSession;
import com.example.chatroom.entity.MessageSessionUserItem;
import com.example.chatroom.mapper.MessageSessionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MessageSessionService {
    @Autowired
    private MessageSessionMapper messageSessionMapper;

    public List<Integer> getSessionIdsByUserId(int userId){
        return messageSessionMapper.getSessionIdsByUserId(userId);
    }

    public List<FriendEntity> getFriendsBySessionId(int sessionId,int userId){
        return messageSessionMapper.getFriendsBySessionId(sessionId,userId);
    }

    public void addMessageSession(MessageSession messageSession){
        messageSessionMapper.addMessageSession(messageSession);
    }

    public void addMessageSessionUser(MessageSessionUserItem messageSessionUserItem){
       messageSessionMapper.addMessageSessionUser(messageSessionUserItem);
    }
}
